﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ComLib.ConfigService;
using LogLib;

namespace KAImage.Config
{
    public class BrowseOption : IniConfigBase
    {
        private string _defaultFolder = @"D:\KPhoto";

        public BrowseOption()
        {

        }

        public string DefaultBrowseFolder
        {
            get { return _defaultFolder; }
            set { _defaultFolder = value; }
        }

        public override bool Save()
        {
            base.Save();
            SaveField("DefaultBrowseFolder", _defaultFolder);
            return true;
        }

        public override bool Load()
        {
            base.Load();
            try
            {
                _defaultFolder = LoadStringValue("DefaultBrowseFolder");
            }
            catch (Exception ex)
            {
                ErrorMessage = string.Format("配置文件{0}加载错误:\n\t{1}", ConfigFilePath, ex.Message);
                Log.WriteException(ex.ToString());
                return false;
            }
            return true;
        }

        public override string ToString()
        {
            StringBuilder builder = new StringBuilder("系统目录选项::");
            builder.Append("默认浏览目录]: " + _defaultFolder);
            return builder.ToString();
        }
    }
}
